<?php
error_reporting(E_ALL);
require "news/News.php";

$news = new News();
echo "<pre>";
var_export($news[0]);

//echo json_encode($news);
echo "</pre>";
echo "<hr >";
echo "<pre>";
var_export($news(0));

//echo json_encode($news);
echo "</pre>";


echo "<ul>";
foreach ($news as $key => $item){
    echo "<li>";
    echo "<h5><a href='detail.php?id=".$key."'> ".$item->indexNum.'、'.$item->title."</a></h5>";
    echo "<div>".$item->content."</div>";
    echo "<span>发布时间：".$item->pubtime."</span>";
    echo "</li>";
}

echo "</ul>";